<?php 
include TMPL_PATH.'public/header.phtml';
?>
<div class="subnav">
    <div class="content-menu ib-a blue line-x">
        <a href='javascript:;' class="on"><em>产品类型管理</em></a><span>|</span>
        <a href='javascript:add();' ><em>添加产品类型</em></a></div>
</div>
<div class="pad_10">
<div class="table-list">
    <table width="100%" cellspacing="0" >
        <thead>
            <tr>
            <th width="100">ID</th>
            <th align='left'>产品类型名称</th>
            <th align='center'>属性分组</th>
            <th align='center' width="100">属性个数</th>
						<th width="150">管理操作</th>
            </tr>
        </thead>
     <tbody>
   <?php 
   	if(isset($modelList) && $modelList):
   		foreach ($modelList as $v):
   ?>
			<tr>
					<td align='center'><?php echo $v['id']?></td>
					<td><?php echo $v['name']?></td>
					<td align='center'><?php echo str_replace(PHP_EOL, ' , ', $v['attr_group']);?></td>
					<td align='center'><?php echo $v['model_count']?></td>
					<td align='center' > 
					<a href="<?php echo U('attribute/attribute_list', 'modelid='.$v['id']);?>">属性列表</a>&nbsp;&nbsp;|&nbsp;&nbsp;
					<a href="javascript:edit(<?php echo $v['id']?>, '<?php echo $v['name']?>')">修改</a>&nbsp;&nbsp;|&nbsp;&nbsp;
					<a href="javascript:confirmurl('<?php echo U('attribute/model_delete', 'modelid='.$v['id']);?>','确认要删除 『<?php echo $v['name']?>』 吗？')">删除</a>
					</td>
				</tr>
	<?php 
		endforeach;
		endif;
	?>
   </tbody>
    </table>
</div>
</div>
</body>
</html>
<script type="text/javascript">
<!--
	function edit(vid, name) {
		window.top.art.dialog({title:'修改--'+name, id:'edit', iframe:'<?php echo U('attribute/model_edit');?>&modelid='+vid ,width:'600px',height:'300px'}, 	function(){var d = window.top.art.dialog({id:'edit'}).data.iframe;
		var form = d.document.getElementById('dosubmit');form.click();return false;}, function(){window.top.art.dialog({id:'edit'}).close()});
	}
function add() {
	window.top.art.dialog({title:'添加--产品类型', id:'add', iframe:'<?php echo U('attribute/model_add');?>' ,width:'600px',height:'300px'}, 	function(){var d = window.top.art.dialog({id:'add'}).data.iframe;
	var form = d.document.getElementById('dosubmit');form.click();return false;}, function(){window.top.art.dialog({id:'add'}).close()});
}
//-->
</script>